#ifndef _MSRCH_H_
#define _MSRCH_H_

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#define MAXCHAR			256
#define FAIL_STATE		-1
#define EMPTY_SLOT		-2
#define MULTI_WAY		-1

#define null 			NULL


union GotoTable
{
	int GotoState;
	int* BranchTable;
};

struct kword
{
	unsigned char* word;
	struct kword* next;
};

void AddStateTrans(int, int, int);
void ComputeFail(void);
void Enter(unsigned char*);
void FindFail(int state, int s, int a);
void QueueAdd(int *queue, int qbeg, int newEle);

void MsrchInit(struct kword* klist);
void MsrchGo(int (*MsrchData)(), void (*MsrchSignal)(char*));
void MsrchEnd();



#endif
